#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define all(s) (s).begin(),(s).end()
#define endl "\n"
#define eb emplace_back
#define ins insert
#define pq priority_queue

using ll=long long;
using ull=unsigned long long;

constexpr int inf=0x3f3f3f3f;
constexpr ll llinf=0x3f3f3f3f3f3f3f3fll;
constexpr int N=100010;

signed main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);
    int n; cin>>n;
    vector<int> tmp(N);
    for(int i=1; i<=n; i++)
    {
        int x; cin>>x;
        tmp[x]++;
    }
    vector<int> cnt; cnt.eb(0);
    for(int i=1; i<=100000; i++) if(tmp[i])
        cnt.eb(tmp[i]);
    int ans=n;
    if(cnt.size()==2) return cout<<ans<<endl, 0;
    // for(auto x: cnt) cerr<<x<<" ";
    vector<int> atk=cnt;
    int l=1, r=2;
    while(cnt[l] && atk[r])
    {
        int sub=min(cnt[l], atk[r]);
        ans-=sub, cnt[l]-=sub, atk[r]-=sub;
        if(!cnt[l])
        {
            while(!cnt[l] && l+1<cnt.size()-1) l++;
            r=l+1;
        }
        if(!atk[r])
        {
            while(!atk[r] && r+1<cnt.size()) r++;
        }
    }
    cout<<ans<<endl;
    return 0;
}